<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <style>
        .boxOne{
            overflow: hidden;
        }
        .item{
            width: 200px;
            height: 200px;
            padding: 20px;
            background-color: aquamarine;
            margin: 10px;
            border: 10px solid #333;
            float: left;
        }
    </style>
</head>
<body>
    <div class="boxOne">
        <div class="item"></div>
        <div class="item"></div>
        <div class="item"></div>
        <div class="item"></div>
        <div class="item"></div>
        <div class="item"></div>
    </div>
    <script>
        var ww = $(window).width();//内容的宽度,content
        var box = $(".item").outerWidth();//整个盒子的宽度，包括padding 和 border
        var num = Math.floor(ww/box);
        $(".boxOne").css({width:num*box+"px"});
    </script>
</body>
</html>